home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / internet / net commander 1.0 / ISP / SCRPTLST / OTTAWA.CMD < prev    next >
Encoding:
Text File  |  1996-03-01  |  3.8 KB  |  184 lines

  1. #    Login.cmd for Internet Access Inc. (www.ottawa.net)
  2. #
  3. #
  4. #  Trumpet Winsock 2.1 Login.cmd
  5. #
  6. #  Copyright (C) 1994,1995 Peter R. Tattam & 
  7. #  Trumpet Software International Pty Ltd (TSI)
  8. #  All rights reserved.
  9. #
  10. #  Unless TSI has given prior written consent to such use, 
  11. #  no permission is granted to distribute or otherwise make available 
  12. #  to the public modified versions of this script for commercial purposes.
  13. #  Any permitted distribution of modified versions of the script must
  14. #  retain the copyright notice at the start of this file and must clearly 
  15. #  identify those parts of the file which have been modified.
  16. #
  17. #trace on
  18. #
  19. # set up some strings for dialling up
  20. #
  21. if ![load $number]
  22.   if [query $number "Enter your dial up phone number"]
  23.     save $number
  24.   end
  25. end
  26. if ![load $username]
  27.   if [username "Enter your login username"]
  28.     save $username
  29.   end
  30. end
  31. if ![load $password]
  32.   if [password "Enter your login password"]
  33.     save $password
  34.   end
  35. end
  36. $modemsetup = "&c1&k3"
  37. $prompt = "umber:"
  38. $userprompt = "name:"
  39. $passprompt = "word:"
  40. $slipcmd = "1"
  41. $addrtarg = "address is"
  42. $pppcmd = "2"
  43. $pppready = "PPP"
  44. %attempts = 10
  45.  
  46. ###############################################
  47. # timeouts for various sections of the script #
  48. ###############################################
  49. #
  50. # timeout for busy tone... adjust this until the BUSY string is detected.
  51. #
  52. %busytimeout = 10
  53. #
  54. # time between successive busy attempts.
  55. #
  56. %busywait = 30
  57. #
  58. # time to wait for a CONNECT string to be received
  59. #
  60. %connecttimeout = 60
  61. #
  62. # time to wait until DCD is detected
  63. #
  64. %onlinetimeout = 60
  65. #
  66. # time to wait for username & password prompts
  67. #
  68. %logintimeout = 60
  69. #
  70. # time to wait for server prompt to appear
  71. #
  72. %prompttimeout = 30
  73. #
  74. # time to wait for a SLIP address to be parsed
  75. #
  76. %addresstimeout = 30
  77. #
  78. #
  79. #
  80. #
  81. #----------------------------------------------------------
  82. #
  83. # initialize modem
  84. #
  85. status "Initializing modem..."
  86. output "atz"\13
  87. if ! [input 5 OK\n]
  88.   message "Modem is not responding"
  89.   abort
  90. end
  91. #
  92. # setup our modem commands
  93. #
  94. output "at"$modemsetup\13
  95. if ! [input 10 OK\n]
  96.   message "Modem is not responding"
  97.   abort
  98. end
  99. #
  100. # send phone number
  101. #
  102. %n = 0
  103. repeat
  104.   %n = %n + 1
  105.   if %n > %attempts
  106.     message "Too many dial attempts"
  107.     abort
  108.   end
  109.   status Dialling $number...(attempt %n)
  110.   output "atdt"$number\13
  111.   %busy = [input %busytimeout BUSY]
  112.   if %busy
  113.     status "The line is busy...pausing for a while"
  114.     sleep %busywait
  115.     %ok = 0
  116.   else
  117.     %ok = [input %connecttimeout CONNECT]
  118.   end
  119. until %ok
  120. input 10 \n
  121. #
  122. #  wait till it's safe to send because some modem's hang up
  123. #  if you transmit during the connection phase
  124. #
  125. wait %onlinetimeout dcd
  126. status Connected.  Now logging in as $username...
  127. #
  128. # now prod the terminal server
  129. #
  130. #output \13
  131. #
  132. #  wait for the username prompt
  133. #
  134. input %logintimeout $userprompt
  135. output $username\13
  136. #
  137. # and the password
  138. #
  139. input %logintimeout $passprompt
  140. output $password\13
  141. #
  142. # we are now logged in
  143. #
  144. status "Logged in. Now switching to Internet..."
  145. input %prompttimeout $prompt
  146. if %ppp
  147.   #
  148.   # jump into ppp mode
  149.   #
  150.   output $pppcmd\13
  151.   #
  152.   # wait for PPP prompt.
  153.   input %prompttimeout $pppready
  154.   #
  155.   display \n\n"PPP mode selected.  Will try to negotiate IP address."\n
  156.   status "PPP mode selected.  Will try to negotiate IP address."
  157.   sleep 1
  158.   #
  159. else
  160.   #
  161.   # jump into slip mode
  162.   #
  163.   output $slipcmd\13
  164.   #
  165.   # wait for the address string
  166.   #
  167.   input %addresstimeout $addrtarg
  168.   #
  169.   # parse address
  170.   #
  171.   address 30
  172.   input %addresstimeout \n
  173.   #
  174.   # we are now connected, logged in and in slip mode.
  175.   #
  176.   display \n
  177.   display Connected.  Your IP address is \i.\n
  178.   status Connected.  Your IP address is \i.
  179.   sleep 1
  180. end
  181. #
  182. # now we are finished.
  183. #
  184.